package com.example.helloworld;

import android.content.Intent;
import android.os.Bundle;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.example.helloworld.databinding.ActivityMainBinding;
import com.example.helloworld.databinding.ActivityOtherBinding;

public class OtherActivity extends AppCompatActivity {

    private ActivityOtherBinding activityOtherBinding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_other);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
        activityOtherBinding = ActivityOtherBinding.inflate(this.getLayoutInflater());
        setContentView(activityOtherBinding.getRoot());
        activityOtherBinding.button2.setOnClickListener(v->{
            this.startActivity(new Intent(this,MainActivity.class));
        });
    }

    @Override
    protected void onStart() {
        super.onStart();
        System.out.println("Other activity onStart");
    }

    @Override
    protected void onResume() {
        super.onResume();
        System.out.println("Other activity onResume");
    }

    @Override
    protected void onPause() {
        super.onPause();
        System.out.println("Other activity onPause");
    }

    @Override
    protected void onStop() {
        super.onStop();
        System.out.println("Other activity onStop");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        System.out.println("Other activity onStop");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        System.out.println("Other activity onRestart");
    }
}